home *** CD-ROM | disk | FTP | other *** search
/ Codemasters Artwork Disc ECTS 2000 ( UK) / Codemasters - Artwork Disc ECTS 2000 (UK).bin / pc / xtras / medial~1 / setfx~1.dir / Internal_121_CheckBox Button.ls < prev    next >
Encoding:
Text File  |  1998-12-01  |  1.6 KB  |  69 lines

  1. property pSpriteNum, pStatus, pActive, pCallBackObj, pRefcon
  2.  
  3. on new me, propList
  4.   set pSpriteNum to getaProp(propList, #sprite)
  5.   set pStatus to getaProp(propList, #cur)
  6.   set pActive to getaProp(propList, #active)
  7.   set pCallBackObj to getaProp(propList, #callback)
  8.   set pRefcon to getaProp(propList, #ref)
  9.   SetUp(me, pStatus)
  10.   SetEnabled(me, pActive)
  11.   return me
  12. end
  13.  
  14. on click me, sNum
  15.   if not pActive then
  16.     exit
  17.   end if
  18.   if not integerp(sNum) then
  19.     set sNum to the clickOn
  20.   end if
  21.   if the memberNum of sprite sNum < 1 then
  22.     exit
  23.   end if
  24.   if not (the name of the member of sprite sNum contains "checkBox") then
  25.     exit
  26.   end if
  27.   set memName to the name of the member of sprite sNum
  28.   set the member of sprite sNum to member (memName && "Down")
  29.   updateStage()
  30.   set selected to 1
  31.   repeat while the stillDown
  32.     if rollOver(sNum) then
  33.       set the member of sprite sNum to member (memName && "Down")
  34.       set selected to 1
  35.     else
  36.       set the member of sprite sNum to member memName
  37.       set selected to 0
  38.     end if
  39.     updateStage()
  40.   end repeat
  41.   SetUp(me, not pStatus)
  42.   if objectp(pCallBackObj) then
  43.     checkBox(pCallBackObj, pRefcon, pStatus)
  44.   end if
  45.   return pStatus
  46. end
  47.  
  48. on SetUp me, newNum
  49.   set pStatus to newNum
  50.   refresh(me)
  51. end
  52.  
  53. on refresh me
  54.   puppetSprite(pSpriteNum, 1)
  55.   if pStatus then
  56.     set the member of sprite pSpriteNum to member "checkBox 1"
  57.   else
  58.     set the member of sprite pSpriteNum to member "checkBox 0"
  59.   end if
  60. end
  61.  
  62. on SetEnabled me, enabled
  63.   set pActive to enabled
  64. end
  65.  
  66. on Release me
  67.   puppetSprite(pSpriteNum, 0)
  68. end
  69.